package com.pattern.builder.improve;

/**
 * @author 冯志立
 * @create 2019-10-22 10:25
 * 指挥者，动态指定制作流程，返回产品
 */
public class HouseDirector {
    HouseBuilder houseBuilder = null;

    //通过构造器传入
    public HouseDirector(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    //通过setter方法传入
    public void setHouseBuilder(HouseBuilder houseBuilder) {
        this.houseBuilder = houseBuilder;
    }

    //如何处理建造房子的流程，交给指挥者
    public House constructHouse(){
        houseBuilder.buildBasic();
        houseBuilder.buildWalls();
        houseBuilder.roofed();
        return houseBuilder.buildHouse();
    }
}
